package com.aya.simple.handler;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 通过如下方式访问，会匹配  org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping
 * http://localhost:8080/controller
 */
@org.springframework.stereotype.Controller("/controller")
public class CustomController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().println("Controller handleRequest,可以返回视图解析器");
        return null;
    }
}
